home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / Kubuntu 8.10 / kubuntu-8.10-desktop-i386.iso / casper / filesystem.squashfs / usr / share / hplip / ui / scrollcopy.py < prev    next >
Text File  |  2008-10-13  |  21KB  |  556 lines

  1. # -*- coding: utf-8 -*-
  2. #
  3. # (c) Copyright 2001-2007 Hewlett-Packard Development Company, L.P.
  4. #
  5. # This program is free software; you can redistribute it and/or modify
  6. # it under the terms of the GNU General Public License as published by
  7. # the Free Software Foundation; either version 2 of the License, or
  8. # (at your option) any later version.
  9. #
  10. # This program is distributed in the hope that it will be useful,
  11. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13. # GNU General Public License for more details.
  14. #
  15. # You should have received a copy of the GNU General Public License
  16. # along with this program; if not, write to the Free Software
  17. # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
  18. #
  19. # Author: Don Welch
  20. #
  21.  
  22. # Local
  23. from base.g import *
  24. from base import utils, pml
  25. from copier import copier
  26.  
  27. # Qt
  28. from qt import *
  29. from scrollview import ScrollView, PixmapLabelButton
  30. from waitform import WaitForm
  31.  
  32. # Std Lib
  33. import os.path, os
  34. import Queue
  35.  
  36.  
  37. class ScrollCopyView(ScrollView):
  38.     def __init__(self, service, num_copies=None, contrast=None, quality=None, 
  39.                 reduction=None, fit_to_page=None, parent=None, form=None, name=None, fl=0):
  40.         ScrollView.__init__(self, service, parent, name, fl)
  41.  
  42.         self.form = form
  43.  
  44.         self.num_copies = num_copies
  45.         self.contrast = contrast
  46.         self.quality = quality
  47.         self.reduction = reduction
  48.         self.fit_to_page = fit_to_page
  49.  
  50.         self.update_queue = Queue.Queue() # UI updates from copy thread
  51.         self.event_queue = Queue.Queue() # UI events to copy thread
  52.  
  53.     def getDeviceSettings(self):
  54.         QApplication.setOverrideCursor(QApplication.waitCursor)
  55.         try:
  56.             # get sticky settings as defaults (if not spec'd on command line)
  57.             if self.num_copies is None:
  58.                 result_code, self.num_copies = self.dev.getPML(pml.OID_COPIER_NUM_COPIES)
  59.  
  60.             if self.contrast is None:
  61.                 result_code, self.contrast = self.dev.getPML(pml.OID_COPIER_CONTRAST)
  62.  
  63.             if self.reduction is None:
  64.                 result_code, self.reduction = self.dev.getPML(pml.OID_COPIER_REDUCTION)
  65.  
  66.             if self.quality is None:
  67.                 result_code, self.quality = self.dev.getPML(pml.OID_COPIER_QUALITY)
  68.  
  69.             if self.scan_style == SCAN_STYLE_FLATBED and self.fit_to_page is None:
  70.                 result_code, self.fit_to_page = self.dev.getPML(pml.OID_COPIER_FIT_TO_PAGE)
  71.  
  72.                 if result_code != pml.ERROR_OK:
  73.                     self.fit_to_page = pml.COPIER_FIT_TO_PAGE_DISABLED
  74.                     self.fitToPageCheckBox.setEnabled(False)
  75.  
  76.             else:
  77.                 self.fit_to_page = pml.COPIER_FIT_TO_PAGE_DISABLED
  78.  
  79.             if self.scan_style != SCAN_STYLE_FLATBED:
  80.                 self.fitToPageCheckBox.setEnabled(False)
  81.  
  82.             result_code, self.max_reduction = self.dev.getPML(pml.OID_COPIER_REDUCTION_MAXIMUM)
  83.             result_code, self.max_enlargement = self.dev.getPML(pml.OID_COPIER_ENLARGEMENT_MAXIMUM)
  84.  
  85.             # contrast
  86.             a = self.contrast/25
  87.             self.contrastSpinBox.setValue(a)
  88.  
  89.             if a >= 0:
  90.                 self.contrastSpinBox.setPrefix("+")
  91.             else:
  92.                 self.contrastSpinBox.setPrefix("")
  93.  
  94.             self.contrastSlider.setValue(a)
  95.             self.contrastSlider.setTickmarks(QSlider.Below)
  96.             self.contrastSlider.setTickInterval(1)
  97.  
  98.             self.contrastDefaultPushButton.setEnabled(a != 0)
  99.  
  100.             # reduction/enlargement/fittopage
  101.             
  102.             self.reductionSlider.setRange(self.max_reduction, self.max_enlargement)
  103.             self.reductionSlider.setTickmarks(QSlider.Below)
  104.             self.reductionSlider.setTickInterval(10)
  105.             self.reductionSlider.setValue(self.reduction)
  106.  
  107.             self.reductionSpinBox.setMaxValue(self.max_enlargement)
  108.             self.reductionSpinBox.setMinValue(self.max_reduction)
  109.             self.reductionSlider.setValue(self.reduction)
  110.             self.reductionSpinBox.setSuffix("%")
  111.  
  112.             if self.fit_to_page == pml.COPIER_FIT_TO_PAGE_ENABLED:
  113.                 self.fitToPageCheckBox.setChecked(True)
  114.                 self.reductionSpinBox.setEnabled(False)
  115.                 self.reductionSlider.setEnabled(False)
  116.                 self.reductionDefaultPushButton.setEnabled(True)
  117.             else:
  118.                 self.fitToPageCheckBox.setChecked(False)
  119.                 self.reductionSlider.setEnabled(True)
  120.                 self.reductionSpinBox.setEnabled(True)
  121.                 self.reductionDefaultPushButton.setEnabled(self.reduction != 100)
  122.  
  123.             # num_copies
  124.             self.copiesSpinBox.setValue(self.num_copies)
  125.             self.copiesDefaultPushButton.setEnabled(self.num_copies != 1)
  126.  
  127.             # quality
  128.             if self.quality == pml.COPIER_QUALITY_FAST:
  129.                 self.qualityComboBox.setCurrentItem(0)
  130.                 s = 'Fast'
  131.  
  132.             elif self.quality == pml.COPIER_QUALITY_DRAFT:
  133.                 self.qualityComboBox.setCurrentItem(1)
  134.                 s = 'Draft'
  135.  
  136.             elif self.quality == pml.COPIER_QUALITY_NORMAL:
  137.                 self.qualityComboBox.setCurrentItem(2)
  138.                 s = 'Normal'
  139.  
  140.             elif self.quality == pml.COPIER_QUALITY_PRESENTATION:
  141.                 self.qualityComboBox.setCurrentItem(3)
  142.                 s = 'Presentation'
  143.  
  144.             elif self.quality == pml.COPIER_QUALITY_BEST:
  145.                 self.qualityComboBox.setCurrentItem(4)
  146.                 s = 'Best'
  147.  
  148.             log.debug("Default Quality: %d (%s)" % (self.quality, s))
  149.  
  150.             self.qualityDefaultPushButton.setEnabled(self.quality != pml.COPIER_QUALITY_NORMAL)
  151.  
  152.             log.debug("Default Num copies: %d" % self.num_copies)
  153.             log.debug("Default Contrast: %d" % self.contrast)
  154.             log.debug("Default Reduction: %d" % self.reduction)
  155.             log.debug("Maximum Reduction: %d" % self.max_reduction)
  156.             log.debug("Maximum Enlargement: %d" % self.max_enlargement)
  157.  
  158.             if self.fit_to_page == pml.COPIER_FIT_TO_PAGE_ENABLED:
  159.                 s = 'Enabled'  # 2
  160.             else:
  161.                 s = 'Disabled' # 1
  162.  
  163.             log.debug("Default Fit to page: %s (%s)" % (self.fit_to_page, s))
  164.             log.debug("Scan style (models.dat: scan-style): %d" % self.scan_style)            
  165.  
  166.         finally:
  167.             self.dev.closePML()
  168.             QApplication.restoreOverrideCursor()
  169.  
  170.  
  171.     def fillControls(self):
  172.         ScrollView.fillControls(self)
  173.  
  174.         self.addGroupHeading("copies", self.__tr("Number of Copies"))
  175.         self.addCopies()
  176.  
  177.         self.addGroupHeading("reduction", self.__tr("Enlargement, Reduction and Fit to Page"))
  178.         self.addEnlargementReduction()
  179.  
  180.         self.addGroupHeading("contrast", self.__tr("Copy Contrast"))
  181.         self.addContrast()
  182.  
  183.         self.addGroupHeading("quality", self.__tr("Copy Quality"))
  184.         self.addQuality()
  185.  
  186.         self.addGroupHeading("space1", "")
  187.  
  188.         self.copyButton = self.addActionButton("bottom_nav", self.__tr("Make Copies(s)"), 
  189.                                 self.copyButton_clicked, 'print.png', 'print-disabled.png', 
  190.                                 self.__tr("Close"), self.funcButton_clicked)
  191.  
  192.  
  193.  
  194.     def onUpdate(self, cur_device=None):
  195.         log.debug("ScrollPrintView.onUpdate()")
  196.  
  197.     def onDeviceChange(self, cur_device=None):
  198.         ScrollView.onDeviceChange(self, cur_device)
  199.  
  200.         self.dev = copier.PMLCopyDevice(device_uri=self.cur_device.device_uri, 
  201.                                         printer_name=self.cur_printer)
  202.  
  203.         self.scan_style = self.dev.mq.get('scan-style', SCAN_STYLE_FLATBED)
  204.         self.copy_type = self.dev.mq.get('copy-type', COPY_TYPE_DEVICE)
  205.  
  206.         if self.scan_style == SCAN_STYLE_SCROLLFED:
  207.             self.fitToPageCheckBox.setEnabled(False)
  208.             self.fit_to_page = pml.COPIER_FIT_TO_PAGE_DISABLED
  209.  
  210.         self.getDeviceSettings()
  211.  
  212.  
  213.     def addCopies(self):
  214.         widget = self.getWidget()
  215.  
  216.         layout12 = QHBoxLayout(widget,5,10,"layout12")
  217.  
  218.         self.textLabel5 = QLabel(widget,"textLabel5")
  219.         layout12.addWidget(self.textLabel5)
  220.         spacer20 = QSpacerItem(20,20,QSizePolicy.Expanding,QSizePolicy.Minimum)
  221.         layout12.addItem(spacer20)
  222.  
  223.         self.copiesSpinBox = QSpinBox(widget,"copiesSpinBox")
  224.         layout12.addWidget(self.copiesSpinBox)
  225.  
  226.         self.copiesDefaultPushButton = QPushButton(widget,"copiesDefaultPushButton")
  227.         layout12.addWidget(self.copiesDefaultPushButton)
  228.  
  229.         self.textLabel5.setText(self.__tr("Number of copies:"))
  230.         self.copiesDefaultPushButton.setText(self.__tr("Default"))
  231.  
  232.         self.copiesSpinBox.setMaxValue(99)
  233.         self.copiesSpinBox.setMinValue(1)
  234.         self.copiesSpinBox.setValue(1)
  235.  
  236.         self.copiesDefaultPushButton.setEnabled(False)
  237.  
  238.         self.connect(self.copiesDefaultPushButton, SIGNAL("clicked()"), self.copiesDefaultPushButton_clicked)
  239.         self.connect(self.copiesSpinBox, SIGNAL("valueChanged(int)"), self.copiesSpinBox_valueChanged)
  240.  
  241.         self.addWidget(widget, "copies")
  242.  
  243.     def copiesDefaultPushButton_clicked(self):
  244.         self.copiesSpinBox.setValue(1)
  245.         self.copiesDefaultPushButton.setEnabled(False)
  246.  
  247.     def copiesSpinBox_valueChanged(self, i):
  248.         self.copiesDefaultPushButton.setEnabled(i != 1)
  249.         self.num_copies = i
  250.  
  251.     def addQuality(self):
  252.         widget = self.getWidget()
  253.         layout34 = QHBoxLayout(widget,5,10,"layout34")
  254.  
  255.         self.textLabel5_4 = QLabel(widget,"textLabel5_4")
  256.         self.textLabel5_4.setText(self.__tr("Quality:"))
  257.         layout34.addWidget(self.textLabel5_4)
  258.  
  259.         spacer20_4 = QSpacerItem(20,20,QSizePolicy.Expanding,QSizePolicy.Minimum)
  260.         layout34.addItem(spacer20_4)
  261.  
  262.         self.qualityComboBox = QComboBox(0,widget,"qualityComboBox")
  263.         layout34.addWidget(self.qualityComboBox)
  264.  
  265.         self.qualityDefaultPushButton = QPushButton(widget,"qualityDefaultPushButton")
  266.         layout34.addWidget(self.qualityDefaultPushButton)
  267.  
  268.         self.qualityComboBox.clear()
  269.         self.qualityComboBox.insertItem(self.__tr("Fast")) # 0
  270.         self.qualityComboBox.insertItem(self.__tr("Draft")) # 1
  271.         self.qualityComboBox.insertItem(self.__tr("Normal")) # 2
  272.         self.qualityComboBox.insertItem(self.__tr("Presentation")) # 3
  273.         self.qualityComboBox.insertItem(self.__tr("Best")) # 4
  274.         self.qualityComboBox.setCurrentItem(2) # Normal
  275.  
  276.         self.qualityDefaultPushButton.setText(self.__tr("Default"))
  277.         self.qualityDefaultPushButton.setEnabled(False)
  278.  
  279.         self.connect(self.qualityComboBox, SIGNAL("activated(int)"), self.qualityComboBox_activated)
  280.         self.connect(self.qualityDefaultPushButton, SIGNAL("clicked()"), self.qualityDefaultPushButton_clicked)
  281.  
  282.         self.addWidget(widget, "quality")
  283.  
  284.     def qualityDefaultPushButton_clicked(self):
  285.         self.qualityDefaultPushButton.setEnabled(False)
  286.         self.qualityComboBox.setCurrentItem(2) # Normal
  287.         self.quality = pml.COPIER_QUALITY_NORMAL
  288.  
  289.     def qualityComboBox_activated(self, i):
  290.         self.qualityDefaultPushButton.setEnabled(i != 2) # Normal
  291.  
  292.         if i == 0:
  293.             self.quality = pml.COPIER_QUALITY_FAST
  294.         elif i == 1:
  295.             self.quality = pml.COPIER_QUALITY_DRAFT
  296.         elif i == 2:
  297.             self.quality = pml.COPIER_QUALITY_NORMAL
  298.         elif i == 3:
  299.             self.quality = pml.COPIER_QUALITY_PRESENTATION
  300.         elif i == 4:
  301.             self.quality = pml.COPIER_QUALITY_BEST
  302.  
  303.  
  304.     def addEnlargementReduction(self):
  305.         widget = self.getWidget()
  306.         layout43 = QGridLayout(widget,1,1,5,10,"layout43")
  307.  
  308.         self.reductionSlider = QSlider(widget,"reductionSlider")
  309.         self.reductionSlider.setOrientation(QSlider.Horizontal)
  310.  
  311.         layout43.addWidget(self.reductionSlider,0,2)
  312.  
  313.         self.reductionSpinBox = QSpinBox(widget, "reductionSpinBox")
  314.         self.reductionSpinBox.setSuffix("%")
  315.         layout43.addWidget(self.reductionSpinBox,0,3)
  316.  
  317.         spacer42 = QSpacerItem(20,20,QSizePolicy.Expanding,QSizePolicy.Minimum)
  318.         layout43.addItem(spacer42,0,1)
  319.  
  320.         self.fitToPageCheckBox = QCheckBox(widget,"fitToPageCheckBox")
  321.         layout43.addWidget(self.fitToPageCheckBox,1,2)
  322.  
  323.         self.reductionDefaultPushButton = QPushButton(widget,"reductionDefaultPushButton")
  324.         layout43.addWidget(self.reductionDefaultPushButton,0,4)
  325.  
  326.         self.textLabel1 = QLabel(widget,"textLabel1")
  327.         layout43.addWidget(self.textLabel1,0,0)
  328.  
  329.         self.textLabel1.setText(self.__tr("Enlargement or reduction (percent):"))
  330.         self.fitToPageCheckBox.setText(self.__tr("Fit to Page"))
  331.         self.reductionDefaultPushButton.setText(self.__tr("Default"))
  332.  
  333.         self.reductionSlider.setRange(25, 400)
  334.  
  335.         self.connect(self.reductionSlider,SIGNAL("valueChanged(int)"),self.reductionSlider_valueChanged)
  336.         self.connect(self.fitToPageCheckBox,SIGNAL("clicked()"),self.fitToPageCheckBox_clicked)
  337.         self.connect(self.reductionDefaultPushButton, SIGNAL("clicked()"), self.reductionDefaultPushButton_clicked)
  338.         self.connect(self.reductionSpinBox, SIGNAL("valueChanged(int)"), self.reductionSpinBox_valueChanged)
  339.  
  340.         self.addWidget(widget, "reduction")
  341.  
  342.     def reductionSlider_valueChanged(self,a0):
  343.         self.reduction = a0
  344.         self.reductionSpinBox.setValue(a0)
  345.         self.reductionDefaultPushButton.setEnabled(a0 != 100)
  346.  
  347.     def reductionSpinBox_valueChanged(self, a0):
  348.         self.reduction = a0
  349.         self.reductionSlider.setValue(a0)
  350.         self.reductionDefaultPushButton.setEnabled(a0 != 100)
  351.  
  352.     def fitToPageCheckBox_clicked(self):
  353.         if self.fitToPageCheckBox.isChecked():
  354.             self.fit_to_page = pml.COPIER_FIT_TO_PAGE_ENABLED
  355.             self.reductionSpinBox.setEnabled(False)
  356.             self.reductionSlider.setEnabled(False)
  357.             self.reductionDefaultPushButton.setEnabled(True)
  358.         else:
  359.             self.fit_to_page = pml.COPIER_FIT_TO_PAGE_DISABLED
  360.             self.reductionSlider.setEnabled(True)
  361.             self.reductionSpinBox.setEnabled(True)
  362.             self.reductionDefaultPushButton.setEnabled(self.reductionSlider.value() != 100)
  363.  
  364.     def reductionDefaultPushButton_clicked(self):
  365.         self.reduction = 100
  366.         self.reductionSlider.setValue(100)
  367.         self.reductionSlider.setEnabled(True)
  368.         self.reductionSpinBox.setValue(100)
  369.         self.reductionSpinBox.setEnabled(True)
  370.         self.fitToPageCheckBox.setChecked(False)
  371.         self.fit_to_page = False
  372.  
  373.     def addContrast(self):
  374.         widget = self.getWidget()
  375.  
  376.         layout41 = QGridLayout(widget,1,1,5,10,"layout41")
  377.  
  378.         self.textLabel1_2 = QLabel(widget,"textLabel1_2")
  379.  
  380.         layout41.addWidget(self.textLabel1_2,0,0)
  381.  
  382.         self.contrastDefaultPushButton = QPushButton(widget,"contrastDefaultPushButton")
  383.  
  384.         layout41.addWidget(self.contrastDefaultPushButton,0,4)
  385.         spacer41 = QSpacerItem(20,20,QSizePolicy.Expanding,QSizePolicy.Minimum)
  386.         layout41.addItem(spacer41,0,1)
  387.  
  388.         self.contrastSlider = QSlider(widget,"contrastSlider")
  389.         self.contrastSlider.setMinValue(-5)
  390.         self.contrastSlider.setMaxValue(5)
  391.         self.contrastSlider.setPageStep(1)
  392.         self.contrastSlider.setOrientation(QSlider.Horizontal)
  393.  
  394.         layout41.addWidget(self.contrastSlider,0,2)
  395.  
  396.         self.contrastSpinBox = QSpinBox(widget, "contrastSpinBox")
  397.         self.contrastSpinBox.setMinValue(-5)
  398.         self.contrastSpinBox.setMaxValue(5)
  399.  
  400.         layout41.addWidget(self.contrastSpinBox,0,3)
  401.  
  402.         self.textLabel1_2.setText(self.__tr("Contrast (-5 lighter to +5 darker):"))
  403.         self.contrastDefaultPushButton.setText(self.__tr("Default"))
  404.  
  405.         self.connect(self.contrastSlider,SIGNAL("valueChanged(int)"),self.contrastSlider_valueChanged)
  406.         self.connect(self.contrastSpinBox, SIGNAL("valueChanged(int)"), self.contrastSpinBox_valueChanged)
  407.         self.connect(self.contrastDefaultPushButton, SIGNAL("clicked()"), self.contrastDefaultPushButton_clicked)
  408.  
  409.         self.addWidget(widget, "contrast")        
  410.  
  411.  
  412.     def contrastSlider_valueChanged(self, a0):
  413.         self.contrastSpinBox.setValue(a0)
  414.         self.contrast = a0 * 25
  415.         self.contrastDefaultPushButton.setEnabled(a0 != 0)
  416.  
  417.     def contrastSpinBox_valueChanged(self, a0):
  418.         if a0 >= 0:
  419.             self.contrastSpinBox.setPrefix("+")
  420.         else:
  421.             self.contrastSpinBox.setPrefix("")
  422.  
  423.         self.contrastSlider.setValue(a0)
  424.         self.contrast = a0 * 25
  425.         self.contrastDefaultPushButton.setEnabled(a0 != 0)
  426.  
  427.     def contrastDefaultPushButton_clicked(self):
  428.         self.contrastSpinBox.setValue(0)
  429.         self.contrastSpinBox.setPrefix("+")
  430.         self.contrastSlider.setValue(0)
  431.         self.contrast = 0
  432.  
  433.  
  434.     def copy_canceled(self):
  435.         self.event_queue.put(copier.COPY_CANCELED)
  436.         # TODO:
  437.         #service.sendEvent(self.sock, EVENT_COPY_JOB_CANCELED, device_uri=self.device_uri)
  438.  
  439.  
  440.     def copy_timer_timeout(self):
  441.         while self.update_queue.qsize():
  442.             try:
  443.                 status = self.update_queue.get(0)
  444.             except Queue.Empty:
  445.                 break
  446.  
  447.             if status == copier.STATUS_IDLE:
  448.                 self.copy_timer.stop()
  449.  
  450.                 #self.pb.hide()
  451.                 #self.form.statusBar().removeWidget(self.pb)
  452.  
  453.             elif status in (copier.STATUS_SETTING_UP, copier.STATUS_WARMING_UP):
  454.                 #self.pb.setProgress(self.pb.progress()+1)
  455.                 pass
  456.  
  457.             elif status == copier.STATUS_ACTIVE:
  458.                 #self.pb.setProgress(self.pb.progress()+1)
  459.                 pass
  460.  
  461.             elif status in (copier.STATUS_ERROR, copier.STATUS_DONE):
  462.                 self.copy_timer.stop()
  463.                 #self.pb.hide()
  464.                 #self.form.statusBar().removeWidget(self.pb)
  465.  
  466.                 # Close the dialog box.
  467.                 #
  468.                 if self.waitdlg is not None:
  469.                     self.waitdlg.hide()
  470.                     self.waitdlg.close()
  471.                     self.waitdlg = None
  472.  
  473.                 if status == copier.STATUS_ERROR:
  474.                     self.form.FailureUI(self.__tr("<b>Copier error.</b><p>"))
  475.                     # TODO:
  476.                     #service.sendEvent(self.sock, EVENT_COPY_JOB_FAIL, device_uri=self.cur_device.device_uri)
  477.  
  478.                 elif status == copier.STATUS_DONE:
  479.                     pass
  480.                     # TODO:
  481.                     #service.sendEvent(self.sock, EVENT_END_COPY_JOB, device_uri=self.cur_device.device_uri)
  482.  
  483.                 self.cur_device.close()
  484.                 self.copyButton.setEnabled(True)
  485.  
  486.                 self.form.close()
  487.  
  488.  
  489.     def copyButton_clicked(self):
  490.         self.copyButton.setEnabled(False)
  491.         try:
  492.             try:
  493.                 self.dev.open()
  494.             except Error:
  495.                 self.form.FailureUI(self.__tr("<b>Cannot copy: Device is busy or not available.</b><p>Please check device and try again. [1]"))
  496.                 return
  497.  
  498.             # TODO:
  499.             #service.sendEvent(self.sock, EVENT_START_COPY_JOB, device_uri=self.cur_device.device_uri)
  500.  
  501.             #self.pb = QProgressBar()
  502.             #self.pb.setTotalSteps(2)
  503.             #self.form.statusBar().addWidget(self.pb)
  504.             #self.pb.show()
  505.  
  506.             log.debug("Num copies: %d" % self.num_copies)
  507.             log.debug("Contrast: %d" % self.contrast)
  508.             log.debug("Reduction: %d" % self.reduction)
  509.  
  510.             s = 'Normal'
  511.             if self.quality == pml.COPIER_QUALITY_FAST:
  512.                 s = 'Fast'
  513.             elif self.quality == pml.COPIER_QUALITY_DRAFT:
  514.                 s = 'Draft'
  515.             elif self.quality == pml.COPIER_QUALITY_NORMAL:
  516.                 s = 'Normal'
  517.             elif self.quality == pml.COPIER_QUALITY_PRESENTATION:
  518.                 s = 'Presentation'
  519.             elif self.quality == pml.COPIER_QUALITY_BEST:
  520.                 s = 'Best'
  521.             
  522.             log.debug("Quality: %d (%s)" % (self.quality, s))
  523.  
  524.             if self.fit_to_page == pml.COPIER_FIT_TO_PAGE_ENABLED:
  525.                 s = 'Enabled'  # 2
  526.             else:
  527.                 s = 'Disabled' # 1
  528.  
  529.             log.debug("Fit to page: %s (%s)" % (self.fit_to_page, s))
  530.             log.debug("Scan style: %d" % self.scan_style)
  531.  
  532.             # Open the dialog box.
  533.             #
  534.             self.waitdlg = WaitForm(0, self.__tr("Copying..."), self.copy_canceled, self, modal=1)
  535.             self.waitdlg.show()
  536.  
  537.             self.copy_timer = QTimer(self, "CopyTimer")
  538.             self.connect(self.copy_timer, SIGNAL('timeout()'), self.copy_timer_timeout)
  539.             self.copy_timer.start(1000) # 1 sec UI updates
  540.  
  541.             self.dev.copy(self.num_copies, self.contrast, self.reduction,
  542.                           self.quality, self.fit_to_page, self.scan_style,
  543.                           self.update_queue, self.event_queue)                
  544.  
  545.         finally:
  546.             #self.cur_device.close()
  547.             #self.copyButton.setEnabled(True)
  548.             pass
  549.  
  550.     def funcButton_clicked(self):
  551.         self.dev.close()
  552.         self.form.close()
  553.  
  554.     def __tr(self,s,c = None):
  555.         return qApp.translate("ScrollCopy",s,c)
  556.